#pragma once


#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;

const string dict_path = "./resource/dict.txt";

class translate
{
public:
    translate()
    {
        ifstream in(dict_path);
        string word, chinese;
        while(in >> word >> chinese)
        {
            _dict[word] = chinese;
        }
        in.close();
    }

    string GetTranslate(const string &word)
    {
        if(_dict.count(word))
            return _dict[word];
        else return "Translation not found";
    }

    string Display()
    {
        for(auto& e : _dict)
        {
            cout << e.first << ":" << e.second << endl;
        }
    }

    ~translate()
    {}
private:
    unordered_map<string, string> _dict;
};